/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package reportcenter.support.resourceload;

import java.io.InputStream;
import java.util.Properties;

/**
 *
 * @author renan
 */
public class SqlProperties {

   private static final String file = "/sql/support.properties";
   private static SqlProperties config;
   private static Properties properties;
   
   private SqlProperties() throws Exception{
      properties = this.loadProperties();
   }
   
   public static SqlProperties getInstance() throws Exception{
      if(config == null){
         config = new SqlProperties();
      }
      return config;
   }
   
   private Properties loadProperties() throws Exception{
      //Carrega caminho relativo a aplicação
      InputStream applicationIS = getClass().getResourceAsStream(file);
      Properties applicationP = new Properties();
      applicationP.load( applicationIS );
      return applicationP;
   }
   
   public Properties getProperties(){
      return this.properties;
   }
   
   public String getProperty(String chave){
      return properties.getProperty(chave);
   }
    
}
